//
//  UIButton+XM.m
//  XMSimonUtils
//
//  Created by 徐盟 on 2023/7/31.
//  Copyright © 2023 xumeng. All rights reserved.
//

#import "UIButton+XM.h"
#import "UIImage+XM.h"
#import "UIColor+XM.h"
#import "UIView+XM.h"

@implementation UIButton (XM)

-(void) setBackgroundNormalColor:(NSString *)colorHex highlightedColor:(NSString *) colorHex2
{
    [self setBackgroundImage:[UIImage color:[UIColor colorWithHexString:colorHex] andSize:self.size] forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage color:[UIColor colorWithHexString:colorHex2] andSize:self.size] forState:UIControlStateHighlighted];
}

-(void) bottomBorderWithColor:(UIColor *) color
{
    CALayer *layer = [CALayer layer];
    layer.backgroundColor = color.CGColor;
    layer.frame = CGRectMake(0.0f, self.frame.size.height - 1, self.frame.size.width, 1.0f);
    [self.layer addSublayer:layer];
}

@end
